<template>
  <div ref="energyConsumption2" style="width: 100%; height: 380px"></div>
</template>

<script>
import * as echarts from "echarts";
import { fangShow5 } from "@/api/charts";

export default {
  mounted() {
    this.drawtreemap();
  },
  methods: {
    drawtreemap() {
      fangShow5()
        .then(({data}) => {
          var chartDom = this.$refs.energyConsumption2;
          console.log(chartDom);
          var myChart = echarts.init(chartDom);
          var option;

          option = {
            title: {
              text: "能源利用率",
            },
            series: [
              {
                type: "treemap",
                data  ////*************** */
              },
            ],
          };

          option && myChart.setOption(option);
        })
        .catch((err) => {});
    },
  },
};
</script>

<style>
</style>